// Common API response types

export interface ApiResponse<T = any> {
  data: T
  message?: string
  success: boolean
}

export interface ApiError {
  message: string
  code?: string | number
  details?: any
}

export interface PaginationParams {
  page?: number
  limit?: number
  sort?: string
  order?: 'asc' | 'desc'
}

export interface PaginatedResponse<T> {
  data: T[]
  total: number
  page: number
  limit: number
  total_pages: number
}

// Repository related types
export interface Repository {
  id: string
  name: string
  description?: string
  visibility: 'public' | 'private'
  owner_id: string
  owner_username: string
  artifact_count: number
  size: number
  created_at: string
  updated_at: string
}

export interface CreateRepositoryRequest {
  name: string
  description?: string
  visibility: 'public' | 'private'
}

export interface UpdateRepositoryRequest {
  description?: string
  visibility?: 'public' | 'private'
}

// Artifact related types
export interface Artifact {
  id: string
  repository_id: string
  digest: string
  media_type: string
  size: number
  tags: string[]
  created_at: string
  updated_at: string
}

export interface ArtifactLayer {
  id: string
  artifact_id: string
  digest: string
  media_type: string
  size: number
  created_at: string
}

// Tag related types
export interface Tag {
  id: string
  repository_id: string
  artifact_id: string
  name: string
  created_at: string
  updated_at: string
}

export interface CreateTagRequest {
  name: string
  artifact_id: string
}

// System stats
export interface SystemStats {
  total_repositories: number
  total_artifacts: number
  total_users: number
  storage_used: number
  storage_limit: number
}

// Audit log
export interface AuditLog {
  id: string
  user_id: string
  username: string
  action: string
  resource_type: string
  resource_id: string
  details?: any
  ip_address: string
  user_agent: string
  created_at: string
}